import request from "@/utils/request";

/**
 * 根据父级uuid获取下级菜单
 * @param parentUuid
 * @returns {AxiosPromise}
 */
export function listByParentUuid(parentUuid) {
    return request({
        url: '/menu/list-by-patent-uuid/' + parentUuid,
        method: 'get',
    })
}

/**
 * 添加子集菜单
 * @param parentUuid
 * @returns {AxiosPromise}
 */
export function addChildren(param, parentUuid) {
    return request({
        url: '/menu/add-children/' + parentUuid,
        method: 'post',
        data: param
    })
}

/**
 * 删除菜单
 * @param uuid
 * @returns {AxiosPromise}
 */
export function deleted(uuid) {
    return request({
        url: '/menu/delete/' + uuid,
        method: 'delete',
    })
}

/**
 * 添加菜单
 * @param param
 * @param parentUuid
 * @returns {AxiosPromise}
 */
export function add(param) {
    return request({
        url: '/menu/add',
        method: 'post',
        data: param
    })
}

/**
 * 修改菜单
 * @param param
 * @param parentUuid
 * @returns {AxiosPromise}
 */
export function update(param, uuid) {
    return request({
        url: '/menu/update/' + uuid,
        method: 'put',
        data: param
    })
}

/**
 * 上移菜单
 * @param uuid
 * @returns {AxiosPromise}
 */
export function moveUp(uuid) {
    return request({
        url: '/menu/move-up/' + uuid,
        method: 'put',
    })
}

/**
 * 下移菜单
 * @param uuid
 * @returns {AxiosPromise}
 */
export function moveDown(uuid) {
    return request({
        url: '/menu/move-down/' + uuid,
        method: 'put',
    })
}

